<?php
   $auth = Auth::getAuth('current_user');
   $userCompany = new userQueries();
   $company = $userCompany->getCompany($auth['company_id']);
   functions::landing_page($auth);
?>
<div class="content_wrapper">
   <div class="padding_5">
      <div class="body_header_container">
         <div class="head">
               <div class="title_head">
                  <i class="icon-asterisk"></i> Account
               </div>
               <div class="">
                  
               </div>
            </div>
      </div>
      <div class="widget">
         <div class="head">
            <div class="title_head">
               General Account Settings
            </div>
            <div class="right_bar_tab">
               <!-- Tabs -->
               <ul class="tabs">
                  <li rel="tab1" class="active">Basic Information</li>
                  <li rel="tab2">Change your username</li>
                  <li rel="tab3">Change your password</li>
                  
                  <?php
                     if($auth['user_level_id']=="2"){
                        echo '<li rel="tab4">Company Information</li>';
                     }
                  ?>
               </ul>
            </div>
         </div>
         <div class="tab_container" style="min-height: 354px;">
            <div id="tab1" class="tab_content" style="display: block;">
               <div class="pull-left" style="width:60%;">
                  <h4><i class="icon-edit"></i> Change Basic Information</h3>
                  <div class="hr"></div>
<!----------------------------   Basic Informations --------------------------->
               <form class="personal_info" method="POST">
                  <div class="fields">
                     <div class="label">Display name:</div>
                     <div class="input_position">
                        <label class="label_value uInfo_<?php echo $auth['id'];?>" id="uInfo_displayName<?php echo $auth['id'];?>"><?php echo $auth['display_name'];?></label>
                        <input type="text" id="eInfo_<?php echo $auth['id'];?>" name="displayName" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['display_name'];?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">First name:</div>
                     <div class="input_position">
                        <label class="label_value uInfo_<?php echo $auth['id'];?>" id="uInfo_firstName<?php echo $auth['id'];?>"><?php echo $auth['first_name'];?></label>
                        <input type="text" id="eInfo_<?php echo $auth['id'];?>" name="firstName" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['first_name'];?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Middle name:</div>
                     <div class="input_position">
                        <label class="label_value uInfo_<?php echo $auth['id'];?>" id="uInfo_middleName<?php echo $auth['id'];?>"><?php echo $auth['middle_name'];?></label>
                        <input type="text" id="eInfo_<?php echo $auth['id'];?>" name="middleName" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['middle_name'];?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Last name:</div>
                     <div class="input_position">
                        <label class="label_value uInfo_<?php echo $auth['id'];?>" id="uInfo_lastName<?php echo $auth['id'];?>"><?php echo $auth['last_name'];?></label>
                        <input type="text" id="eInfo_<?php echo $auth['id'];?>" name="lastName" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['last_name'];?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Contact Number:</div>
                     <div class="input_position">
                        <label class="label_value uInfo_<?php echo $auth['id'];?>" id="uInfo_contactNumber<?php echo $auth['id'];?>"><?php echo "0".$auth['contact_number']; ?></label>
                        <input type="text" id="eInfo_<?php echo $auth['id'];?>" name="contactNumber" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo "0".$auth['contact_number']; ?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Position:</div>
                     <div class="input_position">
                        <label class="label_value" id="uInfo_<?php echo $auth['id'];?>"><?php echo $auth['position'];?></label>
                        <!--<input type="text" id="eInfo_<?php echo $auth['id'];?>" name="companyEmail" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['position'];?>">-->
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Date Registered:</div>
                     <div class="input_position">
                        <label class="label_value" id="uInfo_<?php echo $auth['id'];?>"><?php echo $auth['date_registered'];?></label>
                        <!--<input type="text" id="eInfo_<?php echo $auth['id'];?>" name="companyEmail" class="display input-medium eInfo_<?php echo $auth['id'];?>" value="<?php echo $auth['date_registered'];?>">-->
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label"></div>
                     <div class="input_position" style="margin-top:5px;">
                        <input type="button" data-action-type="personal_info" class="btn-blueBtn edit_personalInfo uInfo_<?php echo $auth['id'];?>" data-id="<?php echo $auth['id'];?>" id="edit_personalInfo" value="Edit">
                        <input type="button" data-action-type="personal_info" class="btn-blueBtn save_personalInfo eInfo_<?php echo $auth['id'];?> display" data-id="<?php echo $auth['id'];?>" id="save_personalInfo" value="Save">
                        <input type="button" data-action-type="personal_info" class="btn-basicBtn cancel_personalInfo eInfo_<?php echo $auth['id'];?> display" data-id="<?php echo $auth['id'];?>" id="cancel_personalInfo" value="Cancel">
                     </div>
                  </div>
               </form>
               </div>
               <div class="pull-right" style="width:30%;">
                  <div style="margin-left: 30px;margin-top: 30px;">
                     <!-- User Photo -->
                     <?php echo $userCompany->avatarPic("companyUser",$auth['id'],"245","234","large","avatar userPhoto personalPhoto"); ?>
                     
                     <form action="/ajax/upload" method="POST" class="uploadingProfilePic" id="personal_photo" enctype="multipart/form-data">
                        <div class="pull-left">
                           <div id="uniform-fileInput" class="uploader">
                              <input type="file" data-action-id="2" value="upload" name="userProfilePic" id="uploadForm" data-action-type="userPhoto" size="24" style="opacity: 0;" class="upfile">
                                 <input type="hidden" value="companyUser" name="userType" />
                                 <span id="uploadFilename_2" class="filename">No file selected</span>
                                 <span class="action">Choose File</span>
                           </div>
                        </div>
                     </form>
                     <center>
                        <img src="/images/loader/loader.gif" class="loaderUploadProfile display" style="margin-top: 5px;"/>
                     </center>
                  </div>
               </div>
               <span class="pull-left length12">
                  <div class="divider"><span></span></div>
              </span>
            </div>
<!----------------------------   Change your Username  --------------------------->        
            <div id="tab2" class="tab_content">
               <div class="pull-left" style="width:50%;">
                  <h4><i class="icon-edit"></i> Change your Username</h3>
                  <div class="hr"></div>
                  <div class="fields">
                     <div class="label">Your Email:</div>
                     <div class="input_position">
                        <input type="text" id="" name="" class="oldUsername input-medium" disabled="disabled" value="<?php echo $auth['email']; ?>" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">New Email:</div>
                     <div class="input_position">
                        <input type="text" id="" name="" class="newUsername input-medium" value="" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label"></div>
                     <div class="input_position" style="margin-top:5px;">
                        <input type="button" class="btn-blueBtn updateUsername" value="Update">
                     </div>
                  </div>
               </div>
               <div class="pull-right" style="width:30%;">
                  <div style="margin-left: 30px;margin-top: 30px;">
                     <!-- User Photo -->
                     <?php echo $userCompany->avatarPic("companyUser",$auth['id'],"245","234","large","avatar userPhoto personalPhoto"); ?>
                     
                     <form action="/ajax/upload" method="POST" class="uploadingProfilePic" id="personal_photo" enctype="multipart/form-data">
                        <div class="pull-left">
                           <div id="uniform-fileInput" class="uploader">
                              <input type="file" data-action-id="2" value="upload" name="userProfilePic" id="uploadForm" data-action-type="userPhoto" size="24" style="opacity: 0;" class="upfile">
                                 <input type="hidden" value="companyUser" name="userType" />
                                 <span id="uploadFilename_2" class="filename">No file selected</span>
                                 <span class="action">Choose File</span>
                           </div>
                        </div>
                     </form>
                  </div>
               </div>
            </div>
<!----------------------------   Change your Password  --------------------------->   
            <div id="tab3" class="tab_content">
               <div class="pull-left" style="width:50%;">
                  <h4><i class="icon-edit"></i> Change your Password</h3>
                  <div class="hr"></div>
                  <div class="fields">
                     <div class="label">Current:</div>
                     <div class="input_position">
                        <input type="password" name="" class="oldPassword input-medium" id="oldPassword" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">New:</div>
                     <div class="input_position">
                        <input type="password" name="" class="newPassword input-medium" id="newPassword" value="" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label">Re-type New:</div>
                     <div class="input_position">
                        <input type="password" name="" class="ReTypePassword input-medium" id="retypePassword" value="" style="margin-top:5px;">
                     </div>
                  </div>
                  <div class="fields">
                     <div class="label"></div>
                     <div class="input_position" style="margin-top:5px;">
                        <input type="button" class="btn-blueBtn updatePassword" value="Update">
                     </div>
                  </div>
               </div>
               <div class="pull-right" style="width:30%;">
                  <div style="margin-left: 30px;margin-top: 30px;">
                     <!-- User Photo -->
                     <?php echo $userCompany->avatarPic("companyUser",$auth['id'],"245","234","large","avatar userPhoto personalPhoto"); ?>
                     
                     <form action="/ajax/upload" method="POST" class="uploadingProfilePic" id="personal_photo" enctype="multipart/form-data">
                        <div class="pull-left">
                           <div id="uniform-fileInput" class="uploader">
                              <input type="file" data-action-id="2" value="upload" name="userProfilePic" id="uploadForm" data-action-type="userPhoto" size="24" style="opacity: 0;" class="upfile">
                                 <input type="hidden" value="companyUser" name="userType" />
                                 <span id="uploadFilename_2" class="filename">No file selected</span>
                                 <span class="action">Choose File</span>
                           </div>
                        </div>
                     </form>
                  </div>
               </div>
            </div>
            <div id="tab4" class="tab_content">
               <div class="pull-left" style="width:60%;">
                  <h4><i class="icon-edit"></i> Change your Company Information</h3>
                  <div class="hr"></div>
                  <form class="companyPersonal_info" method="POST">
                     <div class="fields">
                        <div class="label">Company Name:</div>
                        <div class="input_position">
                           <label class="label_value uCInfo_<?php echo $company['id'];?>" id="uCInfo_companyName<?php echo $company['id'];?>"><?php echo $company['name'];?></label>
                           <input type="text" id="eInfo_<?php echo $company['id'];?>" name="companyName" class="display input-medium eCInfo_<?php echo $company['id'];?>" value="<?php echo $company['name'];?>" style="margin-top:5px;">
                        </div>
                     </div>
                     <div class="fields">
                        <div class="label">Company Code:</div>
                        <div class="input_position">
                           <label class="label_value uCInfo_<?php echo $company['id'];?>" id="uCInfo_companyCode<?php echo $company['id'];?>"><?php echo $company['code'];?></label>
                           <input type="text" id="eInfo_<?php echo $company['id'];?>" name="companyCode" class="display input-medium eCInfo_<?php echo $company['id'];?>" value="<?php echo $company['code'];?>" style="margin-top:5px;">
                        </div>
                     </div>
                     
                     <div class="fields">
                        <div class="label">Company Contact Number:</div>
                        <div class="input_position">
                           <label class="label_value uCInfo_<?php echo $company['id'];?>" id="uCInfo_companyNumber<?php echo $company['id'];?>"><?php echo $company['contact_number'];?></label>
                           <input type="text" id="eCInfo_<?php echo $company['id'];?>" name="companyNumber" class="display input-medium eCInfo_<?php echo $company['id'];?>" value="<?php echo $company['contact_number'];?>" style="margin-top:5px;">
                        </div>
                     </div>
                     <div class="fields">
                        <div class="label">Position:</div>
                        <div class="input_position">
                           <label class="label_value" id="uCInfo_<?php echo $company['id'];?>"><?php echo $company['position'];?></label>
                           <!--<input type="text" id="eInfo_<?php echo $company['id'];?>" name="companyEmail" class="display input-medium eInfo_<?php echo $company['id'];?>" value="<?php echo $company['position'];?>">-->
                        </div>
                     </div>
                     <div class="fields">
                        <div class="label">Date Registered:</div>
                        <div class="input_position">
                           <label class="label_value" id="uCInfo_<?php echo $company['id'];?>"><?php echo $company['date_registered'];?></label>
                           <!--<input type="text" id="eInfo_<?php echo $company['id'];?>" name="companyEmail" class="display input-medium eInfo_<?php $company['id'];?>" value="<?php echo $company['date_registered'];?>">-->
                        </div>
                     </div>
                     <div class="fields">
                        <div class="label"></div>
                        <div class="input_position" style="margin-top:5px;">
                           <input type="button" data-action-type="company_info" class="btn-blueBtn edit_personalInfo uCInfo_<?php echo $company['id'];?>" data-id="<?php echo $company['id'];?>" id="edit_personalInfo" value="Edit">
                           <input type="button" data-action-type="company_info" class="btn-blueBtn save_personalCInfo eCInfo_<?php echo $company['id'];?> display" data-id="<?php echo $company['id'];?>" id="save_personalInfo" value="Save">
                           <input type="button" data-action-type="company_info" class="btn-basicBtn cancel_personalCInfo eCInfo_<?php echo $company['id'];?> display" data-id="<?php echo $company['id'];?>" id="cancel_personalInfo" value="Cancel">
                        </div>
                     </div>
                  </form>
               </div>
               <div class="pull-right" style="width:30%;">
                  <div style="margin-left: 30px;margin-top: 30px;">
                     <!-- Company Photo -->
                     <?php echo $userCompany->avatarPic("companyAdmin",$company['id'],"245","150","Original","avatar userPhoto companyPhoto"); ?>
                     
                     <form action="/ajax/upload" method="POST" class="uploadingProfilePic" id="company_photo" enctype="multipart/form-data">
                        <div class="pull-left">
                           <div id="uniform-fileInput" class="uploader">
                              <input type="file" data-action-id="3" value="upload" name="userCompanyPic" id="uploadForm" data-action-type="companyPhoto" size="24" style="opacity: 0;" class="upfile">
                              <input type="hidden" value="companyAdmin" name="userType" />
                                 <span id="uploadFilename_3" class="filename">No file selected</span>
                                 <span class="action">Choose File</span>
                           </div>
                        </div>
                     </form>
                     <center>
                        <img src="/images/loader/loader.gif" class="loaderUploadCompany display" style="margin-top: 5px;"/>
                     </center>
                  </div>
               </div>
            </div>
            
         </div>
     </div>
   </div>
</div>
<div class="content_wrapper">
   <div class="padding_5">
      <iframe id="google_map" width="1000" height="350" src="https://maps.google.co.uk?output=embed" scrollbar="no"></iframe>
   </div>
</div>
